package com.kitty.game.neidan.controller;

import com.kitty.game.neidan.message.ReqNeidanBreakTask;
import com.kitty.game.neidan.message.ReqOpenPanel;
import com.kitty.game.neidan.service.NeidanService;
import com.kitty.game.role.model.Role;
import com.kitty.mina.annotation.RequestMapping;
import com.kitty.mina.cache.SessionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.mina.core.session.IoSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
@Slf4j
public class NeidanController {

    @Autowired
    private NeidanService neidanService;

    /**
     * 打开内丹面板
     *
     * @param session
     * @param request
     */
    @RequestMapping
    public void openPanel(IoSession session, ReqOpenPanel request) {
        Role role = SessionUtils.getRoleBySession(session);
        neidanService.openPanel(role);
    }

    /**
     * 打开内丹突破
     *
     * @param session
     * @param request
     */
    @RequestMapping
    public void breakTask(IoSession session, ReqNeidanBreakTask request) {
        Role role = SessionUtils.getRoleBySession(session);

        neidanService.breakTask(role,request);
    }

}
